package com.heima.controller;

import com.heima.dto.RegisterDto;
import com.heima.service.IHhUsersService;
import com.heima.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private IHhUsersService iHhUsersService;


    @GetMapping("/openId")
    public Result getOpenId(@RequestParam String code){

        return  Result.success(iHhUsersService.getOpenId(code));
    }
    @PostMapping("/register")
    public  Result register(@RequestBody RegisterDto dto){
        return Result.success(iHhUsersService.register(dto));
    }
}
